package com.example.warehouse_manager.service.impl;

import com.example.warehouse_manager.entity.Unit;
import com.example.warehouse_manager.mapper.UnitMapper;
import com.example.warehouse_manager.service.UnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Yang
* @description 针对表【unit(规格单位表)】的数据库操作Service实现
* @createDate 2024-03-22 19:47:43
*/
@Service
@CacheConfig(cacheNames = "com.example.warehouse_manager.service.impl.UnitServiceImpl")
public class UnitServiceImpl implements UnitService{

    @Autowired
    private UnitMapper unitMapper;

    //查询所有单位
    @Override
    @Cacheable(key = "'all:unit'")
    public List<Unit> queryAllUnit() {
        return unitMapper.findAllUnit();
    }
}




